<template>
  <div class="disease-symptoms-page">
    <!-- 导航栏 -->
    <div class="nav-bar">
      <div class="nav-left">
        <div class="back-arrow" @click="goBack">‹</div>
        <span class="nav-title">疾病症状</span>
      </div>
      <div class="nav-right">
        <div class="search-icon">
          <svg width="18" height="18" viewBox="0 0 18 18" fill="none">
            <path d="M12.5 11H11.71L11.43 10.73C12.41 9.59 13 8.11 13 6.5C13 2.91 10.09 0 6.5 0C2.91 0 0 2.91 0 6.5C0 10.09 2.91 13 6.5 13C8.11 13 9.59 12.41 10.73 11.43L11 11.71V12.5L16 17.49L17.49 16L12.5 11ZM6.5 11C4.01 11 2 8.99 2 6.5C2 4.01 4.01 2 6.5 2C8.99 2 11 4.01 11 6.5C11 8.99 8.99 11 6.5 11Z" fill="white"/>
          </svg>
        </div>
      </div>
    </div>

    <!-- 轮播图区域 -->
    <div class="banner-section">
      <div class="banner">
        <div class="banner-image">
          <img src="./imgs/8.png" alt="疫苗" class="banner-img" />
        </div>
      </div>
      <div class="banner-dots">
        <div class="dot active"></div>
        <div class="dot"></div>
        <div class="dot"></div>
        <div class="dot"></div>
      </div>
    </div>

    <!-- 疾病类别 -->
    <div class="section-card">
      <div class="section-header">
        <h3 class="section-title">疾病类别</h3>
        <a href="#" class="view-all" @click="goToHumanBody">查看全部></a>
      </div>
      <div class="category-grid">
        <div class="category-card">
          <div class="category-icon">
            <img src="./imgs/微信图片_20250804084355.png" alt="骨关节" class="category-img" />
          </div>
          <div class="category-name">骨关节</div>
          <div class="category-count">疾病 78</div>
        </div>
        <div class="category-card">
          <div class="category-icon">
            <img src="./imgs/微信图片_20250804084400.png" alt="眼科" class="category-img" />
          </div>
          <div class="category-name">眼科</div>
          <div class="category-count">疾病 47</div>
        </div>
        <div class="category-card">
          <div class="category-icon">
            <img src="./imgs/微信图片_20250804084403.png" alt="消化系统" class="category-img" />
          </div>
          <div class="category-name">消化系统</div>
          <div class="category-count">疾病 63</div>
        </div>
        <div class="category-card">
          <div class="category-icon">
            <img src="./imgs/微信图片_20250804084406.png" alt="肾" class="category-img" />
          </div>
          <div class="category-name">肾</div>
          <div class="category-count">疾病 34</div>
        </div>
        <div class="category-card">
          <div class="category-icon">
            <img src="./imgs/微信图片_20250804084409.png" alt="神经系统" class="category-img" />
          </div>
          <div class="category-name">神经系统</div>
          <div class="category-count">疾病 147</div>
        </div>
        <div class="category-card">
          <div class="category-icon">
            <img src="./imgs/微信图片_20250804084413.png" alt="妇科" class="category-img" />
          </div>
          <div class="category-name">妇科</div>
          <div class="category-count">疾病 26</div>
        </div>
      </div>
    </div>

    <!-- 常见症状 -->
    <div class="section-card">
      <div class="section-header">
        <h3 class="section-title">常见症状</h3>
        <a href="#" class="view-all">查看全部></a>
      </div>
      <div class="symptom-grid">
        <div class="symptom-card">
          <div class="symptom-image">
            <img src="./imgs/v2_syp9uc.svg" alt="头疼" class="symptom-img" />
          </div>
          <div class="symptom-name">头疼</div>
          <div class="symptom-dept">神经系统</div>
        </div>
        <div class="symptom-card">
          <div class="symptom-image">
            <img src="./imgs/v2_syp9uo.svg" alt="胃痛" class="symptom-img" />
          </div>
          <div class="symptom-name">胃痛</div>
          <div class="symptom-dept">消化系统</div>
        </div>
        <div class="symptom-card">
          <div class="symptom-image">
            <img src="./imgs/v2_sypaaa.svg" alt="便秘" class="symptom-img" />
          </div>
          <div class="symptom-name">便秘</div>
          <div class="symptom-dept">消化系统</div>
        </div>
        <div class="symptom-card">
          <div class="symptom-image">
            <img src="./imgs/v2_sypab7.svg" alt="后背疼" class="symptom-img" />
          </div>
          <div class="symptom-name">后背疼</div>
          <div class="symptom-dept">骨科</div>
        </div>
        <div class="symptom-card">
          <div class="symptom-image">
            <img src="./imgs/v2_syp9uc.svg" alt="牙疼" class="symptom-img" />
          </div>
          <div class="symptom-name">牙疼</div>
          <div class="symptom-dept">牙科</div>
        </div>
        <div class="symptom-card">
          <div class="symptom-image">
            <img src="./imgs/v2_syp9uo.svg" alt="眼睛痒" class="symptom-img" />
          </div>
          <div class="symptom-name">眼睛痒</div>
          <div class="symptom-dept">眼科</div>
        </div>
      </div>
    </div>

    <!-- 底部指示器 -->
    <div class="home-indicator"></div>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'
import { ref } from 'vue'

const router = useRouter()
const loading = ref(false)

const goBack = () => {
  router.push('/home')
}

// 跳转到3D人体模型页面
const goToHumanBody = async () => {
  try {
    loading.value = true
    await router.push('/human-body')
  } catch (error) {
    console.error('跳转失败:', error)
  } finally {
    loading.value = false
  }
}
</script>

<style scoped>
.disease-symptoms-page {
  min-height: 100vh;
  background: #f8f9fa;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* 导航栏 */
.nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  height: 56px;
  background: #007AFF;
  color: white;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.back-arrow {
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.3s ease;
}

.back-arrow:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.back-arrow:active {
  background-color: rgba(255, 255, 255, 0.2);
}

.nav-title {
  font-size: 18px;
  font-weight: 600;
}

.search-icon {
  display: flex;
  align-items: center;
}

/* 轮播图区域 */
.banner-section {
  padding: 16px;
}

.banner {
  background: linear-gradient(135deg, #4A90E2, #2E5BBA);
  border-radius: 12px;
  padding: 0px;
  position: relative;
  height: 180px;
  overflow: hidden;
}

.banner-image {
  position: relative;
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.banner-text {
  position: absolute;
  bottom: 20px;
  left: 20px;
  color: white;
  font-size: 18px;
  font-weight: 600;
}

.banner-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid white;
  background: transparent;
}

.dot.active {
  background: white;
}

/* 卡片样式 */
.section-card {
  background: white;
  margin: 12px 16px;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: #1C1C1E;
  margin: 0;
}

.view-all {
  color: #007AFF;
  text-decoration: none;
  font-size: 13px;
}

/* 疾病类别网格 */
.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.category-card {
  background: white;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  border: 1px solid #f0f0f0;
}

.category-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.category-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.category-name {
  font-size: 13px;
  font-weight: 600;
  color: #1C1C1E;
  margin-bottom: 4px;
}

.category-count {
  font-size: 11px;
  color: #8E8E93;
}

/* 症状网格 */
.symptom-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.symptom-card {
  background: #F2F2F7;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}

.symptom-image {
  width: 100%;
  height: 50px;
  border-radius: 6px;
  margin-bottom: 8px;
  background: #E5E5EA;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.symptom-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.symptom-name {
  font-size: 13px;
  font-weight: 600;
  color: #1C1C1E;
  margin-bottom: 4px;
}

.symptom-dept {
  font-size: 11px;
  color: #8E8E93;
}

/* 底部指示器 */
.home-indicator {
  height: 5px;
  background: #000;
  margin: 20px 16px;
  border-radius: 2.5px;
}

/* 响应式设计 */
@media (max-width: 375px) {
  .category-grid,
  .symptom-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  
  .category-card,
  .symptom-card {
    padding: 12px 8px;
  }
  
  .category-icon {
    font-size: 20px;
  }
  
  .category-name,
  .symptom-name {
    font-size: 12px;
  }
  
  .category-count,
  .symptom-dept {
    font-size: 10px;
  }
}
</style> 